package constant;

import com.itextpdf.text.pdf.CMYKColor;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfSpotColor;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.layout.FlowPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import utils.ReadAndWriteFile;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class Constant {




    public static Map<Integer, PdfReader> pdfReaderMap;
    public static float pt = 72f/25.4f;
    public static String singlePath;
    public static final CMYKColor BLACK = new CMYKColor(0, 0, 0, 1f);
    public static final boolean FONT = true;
    public static final boolean BACK = false;
    public static final PdfSpotColor reg = new PdfSpotColor("All",new CMYKColor(1f,1f,1f,1f));
    public static final String yin_shua_fang_shi_zheng_fan = "正反";
    public static final String yin_shua_fang_shi_zi_fan = "自翻";
    public static final String zhe_ye_dui_zhe = "对折";
    public static final String zhe_ye_shi_zi_zhe = "十字折";
    public static final String open_file_parent = "info/text/file.txt";
    public static final String file_canshu = "info/text/canshu.txt";
    public static final String file_rule= "info/text/rule.txt";
    public static final String font_msyh = "info/font/msyh.ttf";

    public static  float jiao_xian_chang_du = 3;
    public static  float jiao_xian_ju_bian = 2;
    public static  float jiao_xian_cu_xi = 0.1f;
    public static  float space = 4f;
    public static float chuxue = 0;
    public static boolean is_cc = false;
    public static boolean is_cm = false;
    public static boolean is_cy = false;
    public static boolean is_ck = false;
    public static boolean is_left_text = false;
    public static boolean is_right_text = false;
    public static boolean is_top_text = false;
    public static boolean is_bottom_text = false;



    public static String pdf_path;
    public static String titile = "说明书自动拼版(免费)";
    public static int k = 9999;
    public static int width = 340;
    public static int height = 290;
    public static int add_count=0;

    public static Image ico;
    public static boolean hengban;
    public static boolean active = false;
    public static boolean alert_info = false;
    public static boolean qiang_zhi_zheng_fan = false;


    static {
        try {
            ico = new Image(new FileInputStream("info/img/logo.png"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static Stage primaryStage;
    public static Stage peizhiStage;

    public static void init() {
        List<String> list = ReadAndWriteFile.readtFile(file_canshu,"utf-8");
        for(String str:list){
            if(str.indexOf("脚线长度")!=-1){
                jiao_xian_chang_du = Float.valueOf(str.split("=")[1]);
            }else if(str.indexOf("脚线距边")!=-1){
                jiao_xian_ju_bian = Float.valueOf(str.split("=")[1]);
            }else if(str.indexOf("脚线粗细")!=-1){
                jiao_xian_cu_xi = Float.valueOf(str.split("=")[1]);
            }else if(str.indexOf("间距")!=-1){
                space = Float.valueOf(str.split("=")[1]);
            }else if(str.indexOf("C=")!=-1){
                is_cc = str.indexOf("true")!=-1;
            }else if(str.indexOf("M=")!=-1){
                is_cm = str.indexOf("true")!=-1;
            }else if(str.indexOf("Y=")!=-1){
                is_cy = str.indexOf("true")!=-1;
            }else if(str.indexOf("K=")!=-1){
                is_ck = str.indexOf("true")!=-1;
            }else if(str.indexOf("左=")!=-1){
                is_left_text = str.indexOf("true")!=-1;
            }else if(str.indexOf("右=")!=-1){
                is_right_text = str.indexOf("true")!=-1;
            }else if(str.indexOf("下=")!=-1){
                is_bottom_text = str.indexOf("true")!=-1;
            }else if(str.indexOf("上=")!=-1){
                is_top_text = str.indexOf("true")!=-1;
            }
        }
    }

    static {
        init();
    }



}

